import { base } from '$app/paths'; import { checkScope } from '$lib/auth'; import { error, redirect } from '@sveltejs/kit'; export const GET = async (e) => { const scopes = e.params.scopes .split(' ') .flatMap((v) => v.split(',')) .flatMap((v) => v.split('+')) .filter((v) => v); if ( checkScope( await e.locals.auth(), scopes, true, base + '/scope-prompt/ok/if/' + scopes.join(',') ) ) throw redirect(303, base + '/scope-prompt/ok'); else throw error( 500, 'In server mode, this branch should be unreachable. checkScope with getScopeOnFail should never return false outside of the client.' ); };